// 按钮组件，调用面板组件。

try {
  const toggle = this.pageObj.getApiWidgetByAliasName('toggle');
  const process = this.pageObj.getApiWidgetByAliasName('modal-process');
  const configs = process?.widgetObj.configs()
  const $form = this.getApiPage().getApiWidgetByAliasName('judge-content').widgetObj;
  const { dataSource } = $form._option;
  const url = new URLSearchParams(window.location.href)
  let personDetail = JSON.parse(url ? (url.get('personDetail') || '{}') : '{}')
  const defaultData = {
    ...dataSource,
    eventId: dataSource.id,
    eventTitle: dataSource.eventTitle,
    // 下发部门
    taskIssuDepart: personDetail.deptCode,

    // 下发人
    taskIssuer: personDetail.id,
    taskIssuerName: personDetail.personName,

    // 记录人
    takenotesPersonName: personDetail.personName,
    takenotesPersonId: personDetail.id,
  };

  let config;
  switch($event) {
    case '记录动态':
      config = configs['自定义内容']()
      break
    case '误警事件':
      config = configs['自定义内容']('提示：是否确定为误警事件', '确定')
      break
    case '解除事件':
      config = configs['自定义内容']('提示：是否确定解除事件', '确定')
      break
    case '关闭事件':
      config = configs['自定义内容']('提示：是否确定关闭事件', '确定')
      break
    default:
      config = configs[$event]
  }

  if (config) {
    process?.widgetObj.renderModal(config, defaultData)
    process?.showWidget()
  }

  toggle?.widgetObj.toggle()
} catch (e) {
  console.error(e)
}

